<script type="text/javascript">
//for yes notification
$(document).ready(function(){

	$('.yes_notification_btn').click(function(){
		var notifiedId = $('.notified_id').val();
		var basePath   = $('.base_path').val();
		var profileName= $("#profile-name").val();
		$("#notification-content").fadeOut();
		$.ajax({
			//url:basePath+'recipients/sendNotification',
			url:basePath+'recipients/evaluateNotification',
			type:'POST',
			data:'notified_id='+notifiedId,
			success:function(response){
			//alert(response);
				if(response=='false'){
					$('.notification-loader').fadeIn(500).fadeOut(500, function(){
						$('#notification-content').fadeIn().html('<b>'+profileName+'</b> have no recipient added yet.');
					});
				}else if(response=='need'){
					$('.notification-loader').fadeIn(500).fadeOut(500, function(){
						$('#notification-content').fadeIn().html('Need 1 more executor to notify <b>'+profileName+'</b> recipients.');
					});
				}else{
					$('.notification-loader').fadeIn(500).fadeOut(500, function(){
						$('#notification-content').fadeIn().html("<b>"+profileName+"</b> recipients' have been notfied.");
					});
				}
			}
		});//end ajax
		return false;
	});

	$('.no_notification_btn').click(function(){
		var basePath   = $('.base_path').val();
		window.location = basePath+'profile';
		return false;
	});
	return false;
});

</script>
<div class="notification-wrapper">
	<div id="notification-content">
		<div style="padding: 15px; text-align: center;">
			<span>You are about to notify the recipients of <strong><?php echo !empty($ProfileName) ? ucwords($ProfileName) : '';?></strong>. Once you click yes, the recipients will receive an email notifying that this profiler has already passed away. This email will also inform them to visit to MLME website to view his profile, eulogy video and messages for them. <br>You cannot able to undo once you click yes. Do you really want to proceed?</span>
		</div style="margin: 20px 0;padding: 5px 0 0;text-align: center;">
		<div style="padding:5px 0px 0px 0px;">
			<span><input type="button" value="Yes" class="yes_notification_btn notification-button"/></span>
			<span><input type="button" value="No" class="no_notification_btn notification-button"/></span>
		</div>
	</div>
	<div class="notification-loader" style="text-align:center;display:none;">
		<img src="<?php echo base_url();?>assets/images/ajax-loader.gif" alt=""/>
	</div>
	<!-- hidden-->
	<input type="hidden" value="<?php echo $userId;?>" class="notified_id"/>
	<input type="hidden" value="<?php echo base_url();?>" class="base_path"/>
	<input type="hidden" id="profile-name" value="<?php echo !empty($ProfileName) ? ucfirst($ProfileName) : '';?>"/>
	<!--- end hidden -->
</div>
